/**
 * Created by JasonChou on 16/6/7.
 */

import http from '../libs/http'
export default {

  getFeedsByUserId(userId, latestUpdateTime){
    var c = {userId: userId, limit: 10};

    if (latestUpdateTime)
      c.time = latestUpdateTime;

    return http.get({
      url: api + 'new/outbox',
      data: c
    })
  },

  getProductsByUserId(userId, latestUpdateTime){

    var c = {userId: userId, limit: 10};

    if (latestUpdateTime)
      c.updated = latestUpdateTime;
    return http.get({
      url: api + 'new/products',
      data: c
    })
  },

  like(feedId){
    return http.put({
      url: api + 'new/old/feeds/like',
      data: {feed_id: feedId}
    })
  },

  follow(userId){
    return http.post({
      url: api + 'new/followers',
      data: {userId: userId}
    })
  },

  unfollow(userId){
    return http.delete({
      url: api + 'new/followers',
      data: {userId: userId}
    })
  }
}
